package com.neo.base.fileTest

import scala.io.Source

class OpenAndClose {

  def dealFile(filename: String) : Unit = {
    val bufferSource = Source.fromFile(filename)
    for(line <- bufferSource.getLines()) {
      val cols = line.split("|").map(_.trim)
      println(s"${cols(10)}|${cols(11)}")
    }
    bufferSource.close()
  }

}

object OpenAndClose{
  def main(args: Array[String]): Unit = {
    val filename = "D:\\root\\test\\scala\\IDC_httplog_456_20160727223132001.txt"
    val penAndClose = new OpenAndClose
    penAndClose.dealFile(filename)
  }
}